home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / P3SRC.ZIP / ATARI / TXTTEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-07  |  7.1 KB  |  327 lines

  1. /****************************************************************************
  2. *                txttest.c
  3. *
  4. *  This module implements "fill-in-the-blank" pre-programmed texture 
  5. *  functions for easy modification and testing. Create new textures here.
  6. *
  7. *  from Persistence of Vision(tm) Ray Tracer
  8. *  Copyright 1996 Persistence of Vision Team
  9. *---------------------------------------------------------------------------
  10. *  NOTICE: This source code file is provided so that patterns may experiment
  11. *  with enhancements to POV-Ray and to port the software to platforms other 
  12. *  than those supported by the POV-Ray Team.  There are strict rules under
  13. *  which you are permitted to use this file.  The rules are in the file
  14. *  named POVLEGAL.DOC which should be distributed with this file. If 
  15. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  16. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  17. *  Forum.  The latest version of POV-Ray may be found there as well.
  18. *
  19. * This program is based on the popular DKB raytracer version 2.12.
  20. * DKBTrace was originally written by David K. Buck.
  21. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  22. *
  23. *****************************************************************************/
  24.  
  25. /*
  26.  * Some texture ideas garnered from SIGGRAPH '85 Volume 19 Number 3,
  27.  * "An Image Synthesizer" By Ken Perlin.
  28.  *
  29.  * Further Ideas Garnered from "The RenderMan Companion" (Addison Wesley)
  30.  */
  31.  
  32. #include "frame.h"
  33. #include "vector.h"
  34. #include "povproto.h"
  35. #include "texture.h"
  36. #include "povray.h"    /* [DB 9/94] */
  37. #include "txttest.h"   /* [DB 9/94] */
  38. #include "pattern.h"   /* [CY 10/94] */
  39.  
  40.  
  41.  
  42. /*****************************************************************************
  43. * Local preprocessor defines
  44. ******************************************************************************/
  45.  
  46.  
  47.  
  48. /*****************************************************************************
  49. * Local typedefs
  50. ******************************************************************************/
  51.  
  52.  
  53.  
  54. /*****************************************************************************
  55. * Local variables
  56. ******************************************************************************/
  57.  
  58.  
  59.  
  60. /*****************************************************************************
  61. * Static functions
  62. ******************************************************************************/
  63.  
  64.  
  65.  
  66. /*
  67.  * Test new textures in the routines that follow.
  68.  */
  69.  
  70. /*****************************************************************************
  71. *
  72. * FUNCTION
  73. *
  74. *   pattern1
  75. *
  76. * INPUT
  77. *   
  78. * OUTPUT
  79. *   
  80. * RETURNS
  81. *   
  82. * AUTHOR
  83. *
  84. *   POV-Ray Team
  85. *   
  86. * DESCRIPTION
  87. *
  88. *   The pattern routines take an x,y,z point on an object and a pointer to
  89. *   the object's texture description and return the color at that point
  90. *   Similar routines are granite, agate, marble. See txtcolor.c for examples.
  91. *
  92. * CHANGES
  93. *
  94. ******************************************************************************/
  95.  
  96. DBL pattern1 (EPoint, TPat)
  97. VECTOR EPoint;
  98. TPATTERN *TPat;
  99. {
  100.   DBL value;
  101.   /* YOUR NAME HERE */
  102.  
  103.   TPat=TPat;
  104.  
  105.   value = Noise(EPoint);
  106.  
  107.   return(value);
  108.  
  109. }
  110.  
  111.  
  112.  
  113. /*****************************************************************************
  114. *
  115. * FUNCTION
  116. *
  117. *   pattern2
  118. *
  119. * INPUT
  120. *   
  121. * OUTPUT
  122. *   
  123. * RETURNS
  124. *   
  125. * AUTHOR
  126. *
  127. *   POV-Ray Team
  128. *   
  129. * DESCRIPTION
  130. *
  131. *   The pattern routines take an x,y,z point on an object and a pointer to
  132. *   the object's texture description and return the color at that point
  133. *   Similar routines are granite, agate, marble. See txtcolor.c for examples.
  134. *
  135. * CHANGES
  136. *
  137. ******************************************************************************/
  138.  
  139. DBL pattern2 (EPoint, TPat)
  140. VECTOR EPoint;
  141. TPATTERN *TPat;
  142. {
  143.   DBL value;
  144.   /* YOUR NAME HERE */
  145.   TPat=TPat;
  146.  
  147.   value = Noise(EPoint);
  148.  
  149.   return(value);
  150.  
  151. }
  152.  
  153.  
  154.  
  155.  
  156. /*****************************************************************************
  157. *
  158. * FUNCTION
  159. *
  160. *   pattern3
  161. *
  162. * INPUT
  163. *   
  164. * OUTPUT
  165. *   
  166. * RETURNS
  167. *   
  168. * AUTHOR
  169. *
  170. *   POV-Ray Team
  171. *   
  172. * DESCRIPTION
  173. *
  174. *   The pattern routines take an x,y,z point on an object and a pointer to
  175. *   the object's texture description and return the color at that point
  176. *   Similar routines are granite, agate, marble. See txtcolor.c for examples.
  177. *
  178. * CHANGES
  179. *
  180. ******************************************************************************/
  181.  
  182. DBL pattern3 (EPoint, TPat)
  183. VECTOR EPoint;
  184. TPATTERN *TPat;
  185. {
  186.   DBL value;
  187.   /* YOUR NAME HERE */
  188.   TPat=TPat;
  189.  
  190.   value = Noise(EPoint);
  191.  
  192.   return(value);
  193.  
  194. }
  195.  
  196.  
  197.  
  198. /*****************************************************************************
  199. *
  200. * FUNCTION
  201. *
  202. *   bumpy1
  203. *
  204. * INPUT
  205. *   
  206. * OUTPUT
  207. *   
  208. * RETURNS
  209. *   
  210. * AUTHOR
  211. *
  212. *   POV-Ray Team
  213. *   
  214. * DESCRIPTION
  215. *
  216. *   The bumpy routines take a point on an object,  a pointer to the
  217. *   object's texture description and the surface normal at that point and
  218. *   return a peturb surface normal to create the illusion that the surface
  219. *   has been displaced.
  220. *
  221. *   Similar routines are ripples, dents, bumps. See txtbump.c for examples.
  222. *
  223. * CHANGES
  224. *
  225. ******************************************************************************/
  226.  
  227. void bumpy1 (EPoint, Tnormal, normal)
  228. VECTOR EPoint;
  229. TNORMAL *Tnormal;
  230. VECTOR normal;
  231. {
  232.   /* YOUR NAME HERE */
  233.   EPoint=EPoint;
  234.  
  235.   Tnormal = Tnormal;
  236.  
  237.   Assign_Vector(normal, normal);
  238. }
  239.  
  240.  
  241.  
  242. /*****************************************************************************
  243. *
  244. * FUNCTION
  245. *
  246. *   bumpy2
  247. *
  248. * INPUT
  249. *   
  250. * OUTPUT
  251. *   
  252. * RETURNS
  253. *   
  254. * AUTHOR
  255. *
  256. *   POV-Ray Team
  257. *   
  258. * DESCRIPTION
  259. *
  260. *   The bumpy routines take a point on an object,  a pointer to the
  261. *   object's texture description and the surface normal at that point and
  262. *   return a peturb surface normal to create the illusion that the surface
  263. *   has been displaced.
  264. *
  265. *   Similar routines are ripples, dents, bumps. See txtbump.c for examples.
  266. *
  267. * CHANGES
  268. *
  269. ******************************************************************************/
  270.  
  271. void bumpy2 (EPoint, Tnormal, normal)
  272. VECTOR EPoint;
  273. TNORMAL *Tnormal;
  274. VECTOR normal;
  275. {
  276.   /* YOUR NAME HERE */
  277.   EPoint=EPoint;
  278.  
  279.   Tnormal = Tnormal;
  280.  
  281.   Assign_Vector(normal, normal);
  282. }
  283.  
  284.  
  285.  
  286. /*****************************************************************************
  287. *
  288. * FUNCTION
  289. *
  290. *   bumpy3
  291. *
  292. * INPUT
  293. *   
  294. * OUTPUT
  295. *   
  296. * RETURNS
  297. *   
  298. * AUTHOR
  299. *
  300. *   POV-Ray Team
  301. *   
  302. * DESCRIPTION
  303. *
  304. *   The bumpy routines take a point on an object,  a pointer to the
  305. *   object's texture description and the surface normal at that point and
  306. *   return a peturb surface normal to create the illusion that the surface
  307. *   has been displaced.
  308. *
  309. *   Similar routines are ripples, dents, bumps. See txtbump.c for examples.
  310. *
  311. * CHANGES
  312. *
  313. ******************************************************************************/
  314.  
  315. void bumpy3 (EPoint, Tnormal, normal)
  316. VECTOR EPoint;
  317. TNORMAL *Tnormal;
  318. VECTOR normal;
  319. {
  320.   /* YOUR NAME HERE */
  321.   EPoint=EPoint;
  322.  
  323.   Tnormal = Tnormal;
  324.  
  325.   Assign_Vector(normal, normal);
  326. }
  327.